<!-- <page-header autoTitle="false"> </page-header> -->

<div nz-row nzGutter="24" class="py-lg">
  <div nz-col nzMd="24" nzLg="7">
    <nz-card nzTitle="配置规则" nzSize="small" [nzExtra]="optButtion" class="tabs-card" [nzBordered]="false">
      <div nzLayout="inline" se-container>
        <se label="来源类型" labelWidth="0">{{ getSourceType() }}</se>
        <se label="来源表名" labelWidth="0">{{ sourceLabel }}</se>
        <se label="包名">
          <input nz-input [(ngModel)]="packageName" placeholder="包名" nzSize="small" defaultValue="com.af.business" />
        </se>
        <se label="模块名">
          <input nz-input [(ngModel)]="moduleName" placeholder="模块名" nzSize="small" defaultValue="tmp" />
        </se>
        <se label="作者">
          <input nz-input [(ngModel)]="author" placeholder="作者" nzSize="small" />
        </se>
        <!-- <se label="命名规则" labelWidth="0">
          <nz-radio-group nzSize="small" [(ngModel)]="namingRule">
            <label *ngFor="let item of namingRuleList" nz-radio [nzValue]="item.name">{{ item.value }}</label>
          </nz-radio-group>
        </se> -->
      </div>
    </nz-card>
    <ng-template #optButtion>
      <button nz-button nzType="primary" nzSize="small" (click)="fetchJpaCode()" [nzLoading]="isLoading">生产Jpa代码</button>
      <button nz-button *ngIf="!record" nzType="default" nzSize="small" (click)="backPage()" [nzLoading]="isLoading">返回</button>
    </ng-template>
  </div>
  <div nz-col nzMd="24" nzLg="17">
    <nz-card nzTitle="代码信息" nzSize="small" [nzExtra]="cardTabset" class="tabs-card" [nzBordered]="false">
      <nz-tabset
        style="padding: 5px"
        nzTabPosition="top"
        (nzSelectedIndexChange)="jpaSelectIndexChange($event)"
        [nzTabBarExtraContent]="optTabset"
      >
        <nz-tab *ngFor="let entity of jpaEntityScripts" [nzTitle]="entity.javaName" />
      </nz-tabset>
      <ngx-codemirror [(ngModel)]="javaValue" [options]="codeMirrorOptions" />
    </nz-card>
    <ng-template #cardTabset />
    <ng-template #optTabset>
      <button nz-button nzType="primary" nzSize="small" (click)="copyCode()" [nzLoading]="tableLoading">复制</button>
      <button nz-button nzType="default" nzSize="small" (click)="downloadJpaZip()" [nzLoading]="tableLoading">下载代码</button>
    </ng-template>
  </div>
</div>
